package org.egedede.osgi.guishell.actions;

import java.awt.event.ActionEvent;
import java.util.List;
import java.util.Properties;

import org.egedede.osgi.guishell.model.Command;
import org.egedede.osgi.guishell.model.Manager;

public class StopBundleAction extends BackgroundAction {

	private Command stopCommand;
	private Manager manager;

	public StopBundleAction(){
		super("Stop Bundle");
	}

	@Override
	public void doAction(ActionEvent e) {
		List<String> ids = manager.getSelectedIds();
		long id = Long.parseLong(ids.get(0));
		Properties properties = new Properties();
		properties.put("bundle.id", id);
		stopCommand.execute(properties, null, null);

	}
	public Command getStopCommand() {
		return stopCommand;
	}
	public void setStopCommand(Command startCommand) {
		this.stopCommand = startCommand;
	}

	public Manager getManager() {
		return manager;
	}

	public void setManager(Manager manager) {
		this.manager = manager;
	}

}
